package cn.edu.scau.cmi.zhengweibo.client.spring;

import org.springframework.context.ApplicationContext;

import cn.edu.scau.cmi.zhengweibo.spring.domain.Student;
import cn.edu.scau.cmi.zhengweibo.spring.domain.Teacher;
import cn.edu.scau.cmi.zhengweibo.spring.util.ApplicationContextUtil;

public class SpringApplicationContextClient {
	private static Teacher zhengweibo;
	private static Student zhangsan;
	
	public SpringApplicationContextClient() {
		
	}
	
	public static void main(String[] args) {
		ApplicationContext ac = getApplicationContext();
		zhangsan = (Student) ac.getBean("zhangsan");
		System.out.println(zhangsan.getName()+"的毕业设计导师是："+zhangsan.getTutor().getName());
	}
	
	public static ApplicationContext getApplicationContext() {
		ApplicationContext applicationContext = ApplicationContextUtil.getAppliationContext();
		return applicationContext;
	}
}
